﻿using System;
using Aspects.Custom;

namespace Aspects.Unit
{
    class UnitDisplay
    {
        /// <summary>
        /// Used to brighten the display using the embedded Controller
        /// </summary>
        /// <param name="Brightness">A reference the slider bar brightness scale. Returns 0-7.</param>
        internal static void Brighten()
        {
            ECPort.ReadEC((byte)Commands.IncreaseBacklight);
        }

        internal static void Darken()
        {
            ECPort.ReadEC((byte)Commands.DecreaseBacklight);
        }

        internal static int GetBrightness()
        {
            var NewBrightness = ECPort.ReadEC((byte)Commands.BacklightStep);

            if (NewBrightness > 7 || NewBrightness < 0)
                return 0;
            else
                return NewBrightness;

        }
        private enum Commands
        {
            BacklightStep = 0xB5,
            IncreaseBacklight = 0xB6,
            DecreaseBacklight = 0xB7
        }

    }
}
